package com.gs.synedocket.dialog;

import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.gs.synedocket.control.PopupWindow;

public abstract class BasePopupWindow extends PopupWindow {

    private View view;

    public BasePopupWindow(Context context) {
        super(context);
        view = LayoutInflater.from(context).inflate(getLayoutId(), null);
        setContentView(view);
        setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        setBackgroundDrawable(new ColorDrawable(0));
        setOutsideTouchable(true);
        initView();
    }

    public abstract void initView();

    public abstract int getLayoutId();

    protected <I extends View> I fd(int id) {
        return view.findViewById(id);
    }
}
